<!--
 * @Author: daidai
 * @Date: 2022-01-12 14:23:32
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-09-09 14:47:24
 * @FilePath: \web-pc\src\pages\big-screen\view\home.vue
-->
<template>
  <div style="background-color: #000">
    <ScaleScreen :width="1920" :height="1080" class="scale-wrap" :selfAdaption="true">
      <!-- <div class="scale-wrap"> -->
      <div class="bg">
        <dv-loading v-if="loading">Loading...</dv-loading>
        <div v-else class="host-body">
          <!-- <div class="bupt-icon"><img src="../assets/img/bupt.png"></div> -->
          <!-- 头部 s -->
          <div class="d-flex jc-center title_wrap">
            <el-icon v-if="$route.path !== '/front'" class="return-icon" @click="gotoFront">
              <Back />
            </el-icon>
            <div class="zuojuxing"></div>
            <div class="youjuxing"></div>
            <div class="guang"></div>
            <div class="d-flex jc-center">
              <div class="title">
                <!-- <span class="title-text">数据高效管理机制与传输方法测试服务平台</span> -->
                <!-- <span class="title-text">面向6G智能化的数据高效管理与传输系统</span> -->
                <span class="title-text">6G网络智能化技术验证平台</span>
              </div>
            </div>
            <!-- <div class="time">
              <p>{{ currentTime }}</p>
            </div> -->
          </div>

          <!-- 头部 e-->
          <!-- 内容  s-->
          <router-view />
          <!-- 内容 e -->
        </div>
      </div>
      <!-- <Setting ref="setting" /> -->
      <!-- </div> -->
    </ScaleScreen>
  </div>
</template>

<script>
// import { formatTime } from "../utils/index.js";
// import Setting from "./setting.vue";
import ScaleScreen from "@/components/scale-screen/scale-screen.vue";
export default {
  components: { ScaleScreen },
  data() {
    return {
      timing: null,
      loading: true,
      currentDate: "",
      currentTime: "",
    };
  },
  filters: {
    numsFilter(msg) {
      return msg || 0;
    },
  },
  computed: {},
  created() {},
  mounted() {
    this.cancelLoading();
    // 更新日期和时间
    this.updateDateTime();
    // 每秒更新一次时间
    setInterval(() => {
      this.updateDateTime();
    }, 1000);
  },
  beforeDestroy() {
    clearInterval(this.timing);
    // 在组件销毁前清除定时器
    clearInterval(this.timer);
  },
  methods: {
    gotoFront() {
      this.$router.push("/");
    },
    goLogMonitor() {
      this.$router.push("/KeepRecord");
    },
    cancelLoading() {
      let timer = setTimeout(() => {
        this.loading = false;
        clearTimeout(timer);
      }, 500);
    },
    updateDateTime() {
      const now = new Date();
      const year = now.getFullYear();
      const month = String(now.getMonth() + 1).padStart(2, "0"); // 月份从0开始，需要加1并且补零
      const day = String(now.getDate()).padStart(2, "0"); // 日期需要补零
      const hours = String(now.getHours()).padStart(2, "0");
      const minutes = String(now.getMinutes()).padStart(2, "0");
      const seconds = String(now.getSeconds()).padStart(2, "0");
      this.currentDate = `${year}/${month}/${day}`;
      this.currentTime = `${hours}:${minutes}:${seconds}`;
    },
  },
};
</script>

<style lang="scss" scope>
@import "./home.scss";
.time p {
  font-size: 40px; /* 设置字体大小 */
  font-family: "Digital-7", sans-serif;
  color: #a1887f;
}

.return-icon {
  position: absolute;
  left: 30px;
  top: 10px;
  background-color: transparent;
  color: cyan;
  font-size: 40px;
  cursor: pointer;
  outline: none;
  z-index: 1;
}

.return-icon::after {
  content: "首页";
  /* 这是要显示的文字 */
  position: absolute;
  left: 100%;
  /* 将文字放置在图标的右侧 */
  top: 50%;
  transform: translateY(-50%);
  /* 垂直居中对齐 */
  white-space: nowrap;
  /* 防止文字换行 */
  background-color: transparent;
  /* 背景颜色 */
  color: cyan;
  /* 文字颜色 */
  padding: 2px 4px;
  /* 内边距 */
  border-radius: 4px;
  /* 圆角 */
  opacity: 0;
  /* 默认隐藏 */
  transition: opacity 0.3s;
  /* 过渡效果 */
  pointer-events: none;
  /* 防止伪元素影响点击事件 */
  font-size: 24px;
  font-weight: bold;
}

.return-icon:hover::after {
  opacity: 1;
  /* 鼠标悬停时显示 */
  pointer-events: auto;
  /* 鼠标悬停时允许点击 */
}
</style>
